package com.gxa.modules.pc.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxa.common.utils.Query;
import com.gxa.common.utils.TPage;
import com.gxa.modules.model.entity.book.BookPhyCheck;
import com.gxa.modules.pc.order.mapper.BookPhyCheckMapper;
import com.gxa.modules.pc.order.service.BookPhyCheckService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 预约体检表 服务实现类
 * </p>
 *
 * @author zhuiyi
 * @since 2022-11-12 09:47:44
 */
@Service
@Slf4j
public class BookPhyCheckServiceImpl extends ServiceImpl<BookPhyCheckMapper, BookPhyCheck> implements BookPhyCheckService {

    @Override
    public TPage queryByPage(Map<String, Object> searchMap) {
        //其他的查询参数
        String stauts = (String) searchMap.get("stauts");
        String startTime = (String) searchMap.get("startTime");
        String endTime = (String) searchMap.get("endTime");
        String orderField = (String) searchMap.get("orderField");
        String order = (String) searchMap.get("order");
        log.info("------stauts----{}--id---{}--", stauts, stauts);
        IPage<BookPhyCheck> oldPage = this.page(new Query<BookPhyCheck>().getPage(searchMap), new QueryWrapper<BookPhyCheck>()
                .eq(!StringUtils.isBlank(stauts), "stauts", stauts)
                .between(!StringUtils.isAnyBlank(startTime,endTime),"appoint_time",startTime,endTime)
        );
        return new TPage(oldPage);
    }
}
